﻿using System.Data.Entity;
using System.Reflection;
using Abp.EntityFramework;
using Abp.Modules;
using ACN.Mail.EntityFramework;

namespace ACN.Mail
{
    [DependsOn(typeof(AbpEntityFrameworkModule), typeof(MailCoreModule))]
    public class MailDataModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.DefaultNameOrConnectionString = "Default";
            //IocManager.Register<IRepositoryBase<Demo, long>, DemoRepositoryBase<Demo, long>>();
            //Configuration.ReplaceService<IRepository<Task, Guid>>(() =>
            //{
            //    IocManager.IocContainer.Register(
            //        Component.For<IRepository<Task, Guid>, ITaskRepository, TaskRepository>()
            //            .ImplementedBy<TaskRepository>()
            //            .LifestyleTransient()
            //    );
            //});
        }

        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            Database.SetInitializer<MailDbContext>(null);
        }
    }
}
